
abstract class Animal02 {
    eat() {
        console.log('eat')
    }
    abstract sleep(): void
}

// Cannot create an instance of an abstract class.
// let animal = new Animal()

class Dog02 extends Animal02{
    name: string
    constructor(name: string) {
        super()
        this.name = name
    }
    run() {}
    sleep() {
        console.log('dog sleep')
    }
}

let dog = new Dog02('wangwang')
dog.eat()
// dog.sleep()

class Cat02 extends Animal02 {
    sleep() {
        console.log('cat sleep')
    }
}

let cat = new Cat02()
// cat.sleep()

let animals: Animal02[] = [dog, cat]
animals.forEach(item => {
    item.sleep()
})


class WorkFlow {
    step1() {
        return this
    }
    step2() {
        return this
    }
}

new WorkFlow().step1().step2()

class Myflow extends WorkFlow {
    next() {
        return this
    }
}

new Myflow().next().step1().next().step2()








